package com.tl.khadmin.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.tl.khadmin.bean.OrderAftersale;
import com.tl.khadmin.bean.OrderRefund;
import com.tl.khadmin.bean.OrderRefund;
import com.tl.khadmin.page.Page;
import com.tl.khadmin.service.OrderRefundIService;
import com.tl.khadmin.service.OrderRefundIService;
import com.tl.khadmin.util.CommonUtil;

/**
 * 订单退款信息
 * @author 123
 */
@RequestMapping(value = "/order/refund")
@RestController
public class OrderRefundController {
	
	@Resource
	private OrderRefundIService orderRefundService; 
	
	@RequestMapping(value = "/transfer")
	public String transfer(HttpSession session,  Integer id) { 
		if(id == null){
			return null;
		}
		return orderRefundService.transfer(session, id);
	} 
	/**
	 * 审核
	 * @param session 
	 * @return
	 */
	@RequestMapping(value = "/audit") 
	@ResponseBody
	public String audit(HttpSession session, OrderRefund audit) {
		return orderRefundService.audit(session, audit);
	}
	
	/**
	 * @param param level：查询快递公司列表
	 * @param param OrderRefundName：名称，模糊查询
	 * @param param status：1启用，2禁用
	 * @return
	 */
	@RequestMapping(value="/list") 
	public Map<String, List<OrderRefund>> listOrderRefund(@RequestParam Map<String ,Object> param){
		return CommonUtil.returnResultCodeJson("orderRefund", orderRefundService.listOrderRefund(param));
	}

	@RequestMapping(value = "/showbypage")
	public Map<String, Page<OrderRefund>> showProductBrandByPage(HttpSession session, @RequestParam Map<String, Object> params) { 
		Integer pageNum = Integer.parseInt(params.get("pageNum").toString());
		Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
		return CommonUtil.returnResultCodeJson("result", 
				orderRefundService.showOrderRefundByPage(session, pageNum, pageSize, params));
	}
}
